#pragma once
#include <winuser.h>

namespace ioal {

struct ioal_context;
enum IOAL_ErrorCode {Ok, TapFailed, NetworkFailed, ServerConnectionFailed, IPFailed, ClientVersionTooOld};
enum IOAL_Status {init, login, table, game, logout};
//		    login
//	init-------------->login
//			success						failed
//	login------------->table,	login------------->init
//		  begin_game
//	table------------->game
//		  end_game
//	game-------------->table
//		  logout
//	any--------------->logout


#define DllExport extern "C" __declspec( dllexport ) 
#define ON_STATE_CHANGE (WM_USER+930)

DllExport ioal_context* ioal_create(unsigned short port, const char* server);
DllExport void ioal_login(ioal_context* ioal);
DllExport void ioal_login_async(ioal_context* ioal);
DllExport int ioal_login_progress(ioal_context* ioal);
DllExport int ioal_online_players(ioal_context* ioal);
DllExport void ioal_on_state_change(ioal_context* ioal, void (*)());
DllExport void ioal_msg_state_change(ioal_context* ioal, HWND hwnd);
DllExport IOAL_Status ioal_status(ioal_context* ioal);
DllExport const char* ioal_status_string(ioal_context* ioal);
DllExport IOAL_ErrorCode ioal_error_code(ioal_context* ioal);
DllExport const char* ioal_error_string(ioal_context* ioal);
DllExport int ioal_old(ioal_context* ioal);
DllExport void ioal_begin_game(ioal_context* ioal);
DllExport void ioal_end_game(ioal_context* ioal);
DllExport void ioal_logout(ioal_context* ioal);
DllExport void ioal_delete(ioal_context* ioal);
void ioal_test();

enum IOAL_Information {VIP, VMASK};
DllExport const char* ioal_get_information(ioal_context* ioal, IOAL_Information item);

}